C Language Video

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484

Array of Structures in C

 

·       An array of structure in C can be defined as the collection of multiple structures variables where each variable contains information about different entities.

·       The array of structures in C are used to store information about multiple entities of different data types.

·       The array of structures is also known as the collection of structures.

c array of structures


Write a program to explain array of structure.

#include<stdio.h> 

#include <string.h>   

struct student{   

int rollno;   

char name[10];   

};    

int main()

{   

int i;   

struct student st[5];   

printf("Enter Records of 5 students");   

for(i=0;i<5;i++)

{   

printf("\nEnter Rollno:");   

scanf("%d",&st[i].rollno);   

printf("\nEnter Name:");   

scanf("%s",&st[i].name);   

}   

printf("\nStudent Information List:");            

for(i=0;i<5;i++)

{   

printf("\nRollno:%d, Name:%s",st[i].rollno,st[i].name);   

}   

          return 0;   

}   

 

C Language Video

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484